package com.lookme.lmtool.cracker.filter.warping;

import com.jhlabs.image.ScaleFilter;
import com.lookme.lmtool.cracker.CrackerConstants;
import com.lookme.lmtool.cracker.annotation.FilterAnnotation;
import com.lookme.lmtool.cracker.annotation.ParamAnnotation;
import com.lookme.lmtool.cracker.filter.AbstractFilter;
import com.lookme.lmtool.utils.ImageUtils;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;

@FilterAnnotation(groupName = CrackerConstants.FILTER_GROUP_NAME_WARPING,name="图像缩放")
public class FilterScale extends AbstractFilter {

    @XStreamAsAttribute
    @ParamAnnotation(name = "宽度", desc = "宽度",inputType = ParamAnnotation.InputType.Spinner)
    int width=32;
    @XStreamAsAttribute
    @ParamAnnotation(name = "高度", desc = "高度",inputType = ParamAnnotation.InputType.Spinner)
    int height=32;


    @Override
    public BufferedImage filter(BufferedImage src, BufferedImage dst) {
        return ImageUtils.resizeImage(src,width,height);
    }
}
